package com.kamistoat.reactortest.web;

import com.kamistoat.reactortest.entity.Order;
import com.kamistoat.reactortest.feign.TestFeign;
import com.kamistoat.reactortest.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    OrderService orderService;
    @Autowired
    TestFeign testFeign;

    @GetMapping("/all")
    public Flux<Order> getOrders() {
        return orderService.getOrders();
    }

    @GetMapping("/testone")
    @ResponseBody
    public String testone() {
        return testFeign.one();
    }
}
